package cn.cdut.yiwenqian.biz.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.cdut.yiwenqian.biz.interfaces.INewsManager;
import cn.cdut.yiwenqian.dao.interfaces.INewInformationDao;
import cn.cdut.yiwenqian.entity.CdutPostNews;
import cn.cdut.yiwenqian.entityVo.NewsVo;
import cn.cdut.yiwenqian.util.MyPageToolVo;
@Service
@Transactional
public class NewsManagerImpl implements INewsManager {

	@Resource
	private INewInformationDao newsInfomationDao;
	@Override
	public MyPageToolVo<CdutPostNews> fingNewsByAuthorId(Integer userId,int page) {
		return newsInfomationDao.fingNewsByAuthorName(userId, page);
	}

	@Override
	public NewsVo saveNewInformation(CdutPostNews newInformation) throws Exception {
		return new NewsVo(newsInfomationDao.saveNews(newInformation));
	}

	@Override
	public NewsVo findNewsByUnumber(Integer unumber) throws Exception {
		return new NewsVo(newsInfomationDao.findNewsById(unumber));
	}

	@Override
	public MyPageToolVo<CdutPostNews> findAllNewsInSystem(int page) {
		return newsInfomationDao.findAllNewsInSystem(page);
	}

}
